<template>
	<view class="wrap">
		<js-error mode="bottom" ref="jsError"></js-error>
		<view class="cu-bar bg-white ">
			<view class="action">
				<u-icon name="/static/common/img/invcode.png" size="80"></u-icon>
				<text class="cuIcon-titles text-green text-bold">货位信息</text> 
			</view>
		</view>
		<u-form class="form bg-white" :model="model"  ref="uForm" label-position="left">
			<u-form-item label="确认发货重量:" prop="qrWeight" label-width="200" :label-style="{'font-weight':'bold'}">
				<u-input placeholder="请输入确认发货重量" v-model="model.qrWeight" type="text" di maxlength="64"></u-input>
			</u-form-item>
			<u-form-item label="发货批次:" prop="ibatch" label-width="200" :label-style="{'font-weight':'bold'}">
				<u-input placeholder="请输入发货批次" v-model="model.ibatch" type="text" di maxlength="64"></u-input>
			</u-form-item>
			<u-form-item label="发货货位:" prop="cposition" label-width="200" :label-style="{'font-weight':'bold'}">
				<u-input placeholder="请输入发货货位" v-model="model.cposition" type="text" di maxlength="64"></u-input>
			</u-form-item>
		</u-form>
		<view class="form-footer b-btns">
			<view class="footer">
				<u-button class="btn" type="primary" @click="submit">保存</u-button>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				model:{
					id:'',
					hid:'',
					qrWeight:'',
					ibatch:'',
					cposition:'',
				},
				hid:'',
				carVenSelectList: [],
				pickerTime: false,//控制日期显示
			}
		},
		onLoad(params){
			this.model.hid = params.hid
		},
		onShow() {
		},
		methods: {
			submit(data, callback) {
				if(this.model.hid== null || this.model.hid == ''){
					this.$refs.jsError.showError('','请正确选择计划详情！','error');
					return;
				}else if(this.model.qrWeight == null || this.model.qrWeight == ''){
					this.$refs.jsError.showError('','请正确填入确认发货重量！','error');
					return;
				}else if(this.model.ibatch == null || this.model.ibatch == ''){
					this.$refs.jsError.showError('','请正确填入发货批次！','error');
					return;
				}else if(this.model.cposition == null || this.model.cposition == ''){
					this.$refs.jsError.showError('','请正确填入发货货位！','error');
					return;
				}else{
					this.$u.api.mffh.saveDetail(this.model).then(res => {						
						if(res.result == 'true'){
							this.$u.toast(res.message);
							uni.$emit('refreshData');
							uni.navigateBack({
								delta: 1,
							})
						}else{
							this.$refs.jsError.showError('',res.message,'error');
						}
					});
				}
			},
		}
	}
</script>
<style>
.footer {
	position: fixed;
	left: 0;
	bottom: 20px;
	width: 100%;
	
}
</style>